package com.w2cx.selenium.business;

import com.w2cx.selenium.base.DriverBase;
import com.w2cx.selenium.operate.ColdBootManageOperate;

public class ColdBootManageProcess  {

    DriverBase driver;
    ColdBootManageOperate cbmo;
    String selectedContentID = null;
    String firstContentID = null;
    String afterDelFirstContentID = null;
    public ColdBootManageProcess(DriverBase driver){
        this.driver = driver;
        cbmo = new ColdBootManageOperate(driver);
    }

    //添加冷启动内容
    public void addColdContent(){
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        cbmo.clickOperateManageMenu();
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }


        cbmo.clickColdBootManageMenu();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }


        cbmo.clickContentManageLink();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }


        cbmo.clickSelectContentBtn();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }


        selectedContentID = cbmo.getSelectedContentID();


        cbmo.clickSelectContentCheckBox();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }


        cbmo.clickCloseBtn();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }


        firstContentID = cbmo.getFirstContentID();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }




    }


    //判断增加
    public boolean addColdContentSuccess(){
        if(firstContentID.equals(selectedContentID)){
            return true;
        }else {
            return false;
        }

    }


    //删除选择的内容
    public void delColdContent(){
        cbmo.clickDelBtn();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }


        cbmo.clickDelConfirmBtn();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }


        afterDelFirstContentID = cbmo.getFirstContentID();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }


    //判断
    public boolean delColdBootContentSuccess(){

        if(!afterDelFirstContentID.equals(selectedContentID)){
            return true;
        }else {
            return false;
        }
    }


}
